﻿using log4net;
using System;
namespace NancyBase
{
    /// <summary>
    /// 版 本 Kinfar-ADMS V8.0.0 君飞敏捷开发框架
    /// Copyright (c) 2008-2018 君飞信息技术有限公司
    /// 创建人：框架开发组
    /// 日 期：2017.03.04
    /// 描 述：redis操作方法
    /// </summary>
    public class LogFactory
    {
        public static log4net.Repository.ILoggerRepository repository { get; set; }
        /// <summary>
        /// 构造函数
        /// </summary>
        static LogFactory()
        {
            repository = LogManager.CreateRepository("NETCoreRepository");
            // 指定配置文件             
            log4net.Config.XmlConfigurator.Configure(repository, new System.IO.FileInfo("log4net.config"));
        }
        /// <summary>
        /// 获取日志操作对象
        /// </summary>
        /// <param name="type">类型</param>
        /// <returns></returns>
        public static Log GetLogger(Type type)
        {
            return new Log(LogManager.GetLogger(type));
        }
        /// <summary>
        /// 获取日志操作对象
        /// </summary>
        /// <param name="str">名字</param>
        /// <returns></returns>
        public static Log GetLogger(string str,Type type)
        {
            return new Log(LogManager.GetLogger(str, type));
        }

    }
}
